package com.xxl.shoppingapp.http;

import com.loopj.android.http.RequestParams;

/**
 * @author xuelian.xiong 2018/4/9
 * @Package com.xxl.shoppingapp.http
 * @Title: ShoppingRequest
 * @Description: (用一句话描述该文件做什么)
 * Copyright (c) 传化公路港物流有限公司版权所有
 * Create DateTime: 2018/4/9
 */
public class ShoppingRequest extends BaseRequest {

    //2 注册
    public static void register(String phoneNo, String password, String address,String email, ResponseListener listener) {
        String url = RequestHelper.getInstance().BASE_HTTPS_URL + "/register.do";
        RequestParams params = new RequestParams();
        params.add("username", phoneNo);
        params.add("password", /*EncryptUtil.sha1Encrypt(*/password);
        params.add("address", address);
        params.add("email", email);
        params.add("mobile", phoneNo);
        HttpClientUtil.post(url, params, listener);

    }

    //3 登录
    public static void login(String phoneNo, String password, ResponseListener listener) {
        String url = RequestHelper.getInstance().BASE_HTTPS_URL + "/login.do";
        RequestParams params = new RequestParams();
        params.add("username", phoneNo);
        params.add("password", /*EncryptUtil.sha1Encrypt(*/password);
        HttpClientUtil.post(url, params, listener);
    }

    //3 登录
    public static void getProductListByType(String type, ResponseListener listener) {
        String url = RequestHelper.getInstance().BASE_HTTPS_URL + "/goods/type";
        RequestParams params = new RequestParams();
        params.add("type", type);
        HttpClientUtil.get(url, params, listener);
    }

    //3 登录
    public static void getProductListBySecType(String secType, ResponseListener listener) {
        String url = RequestHelper.getInstance().BASE_HTTPS_URL + "/findGoodsBySecType";
        RequestParams params = new RequestParams();
        params.add("secType", secType);
        HttpClientUtil.get(url, params, listener);
    }
}
